User blog:Coachbudka/coachbudka's secrets, revealed!
=About me= I’m a 32-year old professional software architect at IBM. I design and build enterprise report-building systems at work, and play sports recreationally and undertake fun programming projects at home. I live in Toronto, Canada with my wife. =About coachbudka= Budka is a Cloudball program I wrote, largely from my experience as a soccer player. There are lots of moving parts that most programs should have, such as calculating intercepting the ball, shooting on goal, etc. The thing that sets my program apart, in my opinion, is in the main movement engine, which is modeled after how a human would work. On the ball: Shoot, pass, or move? A player holding the ball will shoot, given the opportunity. We calculate spots located at 0.5, 0.3, 0.7, 0.1, and 0.9 (where 0.5 is the middle of the net, 0 is the top, 1.0 is the bottom) to see if we can beat all opposing players at different speeds. Take the slowest shot that beats everybody. Failing that, the options are weighed for passing and moving. Different passes are simulated to see if we can catch the ball before the opponents (including one bounce). Of those, we record the one with the highest evaluation of offensive potential, after factoring in a penalty for the speed of the pass. Different moves are also simulated. We consider a move of 20 pixels in several directions, throwing out any option that would bring us close to an enemy that can tackle. We record the one with the highest evaluation of offensive potential. Offensive potential is calculated by summing together the extent to which each opponent stands between that spot and the enemy goal, nothing else. This tends to favour spots nearer the enemy goal because the enemies are more “behind” those spots. The option with the best offensive potential is performed. Off the ball: Forces and particles Every player, when he doesn’t have the ball, acts as a particle subject to a number of forces. There are two types of forces in the system: elastic, and gravity/electromagnetic. As you’ll recall from high school, elastic forces get stronger the farther away the particle is, and gravity forces get stronger the closer the particle is. Each force is governed by a principle lifted from real life playing. Every player off the ball (except the keeper) moves by simply summing the forces. Stay in position Forwards have a slight elastic force pulling them towards the enemy goal line. Defensemen have an elastic force pulling them towards their own goal line. Left and right positions have weak forces keeping them there. Players will defy these forces if circumstances call for it, but in the absence of other stronger forces, they will go back into position. If we are on the offense, the elastic forces are shifted downfield. Stay away from friendly players Being near friendly players creates an over-concentration of strength, and correspondingly weak coverage in other areas of the field. “Spread out!!” you’ll hear parents call out at kids’ soccer games. When not carrying the ball, players have a strong opposing gravity force for other friendly players, whether on offense or defense. Stay near opponents on defense; stay away from opponents on offense This is natural. Attractive gravity forces are applied to enemies on defense, repulsive forces are applied to enemies on offense. This results in the defensive line leaning to one side if the opponents are over-concentrated on that side. Like being near the ball This is natural. There is always an elastic attractive force applied to the ball for all players, offense or defense. Note the balance between being near the ball and not being near each other. Hate the walls Walls are yucky places to be when not holding the ball. A strong repulsive gravity force is applied from each wall. Remember, the closer we are, the more of an effect this has. Goalie(s) Yes, plural. Ice_Harley started dumping the ball into my corners one day, pulling my goalie out of position. So I made it so that if the goalie runs out to fetch a ball, swap in a new goalie if a better choice is available. This has saved me numerous times when my old goalie coughs up the ball in the middle of the field. My goalie stands in the middle of the angle formed between the ball and my two goalposts, and charges the ball carrier if he gets too close. =New developments= The above ideas were good enough to finish 3rd in the competition. Since then, other players have joined the fray, knocking me down to 5th. I’ve since made some adjustments, listed here, which has placed me squarely in 1st place. Remember the PickupTimer My previous versions never attempted to pass through any player, even if the players were nearly on top of each other and the ball should clear the opponent before the PickupTimer expires. This is now fixed. Preserve tackles I noticed in my replays with Ice_Harley that I wasted a lot of tackles. He ran right up to my players, then passed the ball away one frame before I performed a tackle. I had been tackling any player near the ball – now I only tackle if there’s some chance that in so doing I’ll be able to pick up the ball. This economic move has kept lots of players away from my net because they are scanning for enemies who are able to tackle – which I now am more often. Use up enemy tackles Again, thanks to Ice_Harley. Now, whilst moving, I do not throw away options that bring me close to opponents who can tackle. I go right up to them. If I detect that in the next frame I could be tackled, I never move (always pass). This reduces the opponent’s ability to tackle so I can move the ball downfield with impunity. Consider our ability to tackle Thanks to delineate for this one. When shooting or passing, it’s possible that we can complete a pass despite an intervening enemy because we are able to tackle an enemy within a few frames (possibly using the ball carrier himself). Take these options into account, but penalize them (they are only 80% sure). This one development caused a massive upswing in skill, because now I can run over goalies on breakaways. :) Category:Blog posts